<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function isZhishu(num) {
        // 假设是质数
        var flag = true
        // 验证假设是否成立
        for (var i = 2; i < num; i++) {
          // 如果num % i ===0 那么就不是质数
          if (num % i === 0) {
            return (flag = false)
          }
        }
        // 接收返回值
        return flag
      }
     

      for (var j = 2; j <= 100; j++) {
        var res = isZhishu(j)
        if (res) {
            console.log(j);
        }
      }
    </script>
  </body>
</html>
